package com.city.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * Created with IntelliJ IDEA.
 * User: Cheng
 * Date: 2020/4/27
 * Time: 15:30
 * Description: No Description
 */
@Configuration
public class ConfigBean {//spring 类 配置文件 就是spring.xml配置文件
    //通过RestTemplate来发现和获取服务器，通过它来设置ribbo负载均衡
    @Bean
    @LoadBalanced //开启负载均衡
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
